<template>
    <div class="demo-collapse">
        <el-collapse v-model="activeNames" @change="handleChange">
            <el-collapse-item title="问题描述" name="des">
                <div class="detail">
                    <img class="image" src="../../../../../assets/冒泡排序/冒泡排序1.png">
                    <div class="text">
                        通过对待排序序列从前向后（从下标较小的元素开始）,依次对相邻两个元素的值进行两两比较，
                        若发现逆序则交换，使值较大的元素逐渐从前移向后部，就如果水底下的气泡一样逐渐向上冒。
                    </div>
                </div>
            </el-collapse-item>
            <el-collapse-item title="相关研究" name="3">
                <ul>
                    <li v-for="item in thesisData" :key="item.title">
                        <a :href="item.link" target="_blank">
                            <div class="thesis">
                                <img class="thesis-cover" src="../../../../../icons//thesis.svg" alt="">
                                <div class="thesis-title">
                                    {{item.title}}
                                </div>
                                <div class="thesis-author">
                                    <span>作者：</span>{{ item.author }}
                                </div>
                                <div class="thesis-time">
                                    <span>时间：</span>{{ item.time }}
                                </div>
                                <div class="thesis-source">
                                    <span>来源：</span>{{ item.source }}
                                </div>
                            </div>
                        </a>
                    </li>
                </ul>
            </el-collapse-item>
            <el-collapse-item title="应用领域" name="4">
                <div class="detail">
                    <img class="use" src="../../../../../assets//冒泡排序/冒泡排序2.png" alt="">
                    <div class="text">
                        冒泡排序法是最经典，最基础的排序算法之一。该算法在工程实践中应用较多，比如一个公司要统计所有部门的营业额，
                        把这些部门按照营业额从小到大排序，当两个部门营业额相同时二者保持原来的顺序 ，对于这类问题就需要用稳定的排序算法来处理了。
                    </div>
                </div>
            </el-collapse-item>
        </el-collapse>
    </div>
</template>

<script lang="ts" setup>
import { ref } from 'vue'
const activeNames = ref(['1'])
const handleChange = (val: string[]) => {
    console.log(val)
}

// 相关研究部分
const thesisData=[
    {
        title:"冒泡算法的几种优化与形变",
        author:"胡伟东",
        time:"2023年",
        source:"百度学术",
        link:"https://xueshu.baidu.com/usercenter/paper/show?paperid=181q0cx0vj0f0e40p92p0rc0w9655792&site=xueshu_se",
    },
    {
        title:"不一样的冒泡排序",
        author:"陈凯",
        time:"2019年",
        source:"百度学术",
        link:"https://xueshu.baidu.com/usercenter/paper/show?paperid=15730j60715s0850ab7s0610n9763387&site=xueshu_se",
    },
    {
        title:"两种交换排序算法的分析比较",
        author:"李家宏，孙庆英",
        time:"2023年",
        source:"百度学术",
        link:"https://xueshu.baidu.com/usercenter/paper/show?paperid=146m0m90xd6v0tg0ue5b0ey00b727286&site=xueshu_se",
    },

]
</script>

<style scoped lang="scss">
* {
    list-style: none;
}
.image {
    width: 290px;
    border-radius: 10px;
}
a {
	text-decoration: none; /* 去除默认的下划线 */
	outline: none;	/* 去除旧版浏览器的点击后的外虚线框 */
	color: #000;	/* 去除默认的颜色和点击后变化的颜色 */ 
}

.detail {
    display: flex;
    justify-content: center;
    align-items: end;

    .text {
        margin-left: 10px;
        cursor: default;
    }

    .use {
        width: 240px;
        height: 150px;
        border-radius: 10px;
    }
}

// 相关研究部分
.thesis {
    width: 98%;
    position: relative;
    left: 20px;
    margin-bottom: 10px;
    font-weight: normal;
    background:#F5F5F5;
    border-radius: 10px;
    transition: all 0.2s linear;
    .thesis-title {
        position: absolute;
        top: 0;
        left: 5px;
    }
  
    .thesis-author {
        position: absolute;
        top: 25px;
        left: 120px;
    }

    .thesis-time {
        position: absolute;
        top:45px;
        left: 120px;
    }
    .thesis-source {
        position: absolute;
        top: 65px;
        left: 120px;
    }
    &:hover {
        cursor: pointer;
        transform: translateX(-15px);
    }
}
</style>